<%-- 
    Document   : rssearchhistory
    Created on : Oct 30, 2011, 10:41:06 PM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model"%>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'datemsg', 'to', 'from', 'hours', 'minutes', 'historysystem', 'notice', 'rightmsg', 'historyinfo', 'timehistory', 'user', 'operation', 'object', 'search', 'delete'  "; // chuỗi chứa các mã tham số của trang này.
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.
            String datemsg = mdsts[0].getTenTS();
            String delete = mdsts[1].getTenTS();
            String from = mdsts[2].getTenTS();
            String historyinfo = mdsts[3].getTenTS();
            String historysystem = mdsts[4].getTenTS();
            String hours = mdsts[5].getTenTS();
            String minutes = mdsts[6].getTenTS();
            String notice = mdsts[7].getTenTS();
            String object = mdsts[8].getTenTS();
            String operation = mdsts[9].getTenTS();
            String rightmsg = mdsts[10].getTenTS();
            String search = mdsts[11].getTenTS();
            String timehistory = mdsts[12].getTenTS();
            String to = mdsts[13].getTenTS();
            String user = mdsts[14].getTenTS();

            String msgright = notice + "/" + rightmsg;
            String msgdate = notice + "/" + datemsg;
            Vector v = (Vector) request.getAttribute("DSNK");

            int numpage = 0;// khởi tạo số trang = 0
            int vsize = v.size();
            if (vsize % 10 == 0) // mỗi trang có 10 dòng
            {
                numpage = vsize / 10;
            } else {
                numpage = vsize / 10 + 1;
            }
            String xx = (String) request.getAttribute("item"); // trang hiện tại đang xem
            int item = Integer.parseInt(xx);
            String nhanvienn = (String) request.getAttribute("nhanvien");
            String thaotacc = (String) request.getAttribute("thaotac");
            String doituongg = (String) request.getAttribute("doituong");
            String tungay = (String) request.getAttribute("tungay");
            String tugio = (String) request.getAttribute("tugio");
            String tuphut = (String) request.getAttribute("tuphut");
            String denngay = (String) request.getAttribute("denngay");
            String dengio = (String) request.getAttribute("dengio");
            String denphut = (String) request.getAttribute("denphut");
            int total = 0;
%>
<script type="text/javascript">
    $(function(){
        $('#datepicker1').datepicker($.datepicker.regional['vi']);
        $( "#datepicker1" ).datepicker( "option", "dateFormat","dd/mm/yy");
        $('#datepicker2').datepicker($.datepicker.regional['vi']);
        $( "#datepicker2" ).datepicker( "option", "dateFormat","dd/mm/yy");
    });
</script>
<h1><img style="margin-right: 13px; opacity: 0.8; margin-top: 7px;" alt="" src="../images/nhomma.png"><%=historysystem%></h1>
<div class="cb"></div>
<div class="bloc">
    <div class="title">
        <%=historyinfo%>
    </div>

    <div class="content">
        <form name="dsnk" action="">
            <table>
                <thead>
                    <tr>
                        <th style="width: 8%;" class="STT">
                            
                            <input type="checkbox"  onclick="CheckAllKV()">
                            
                        </th>
                        <th style="width: 35%;">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" shape="<%=msgdate%>" onclick="SortSearchNgayGioNK( this.className, this.name, this.lang, this.shape)">
                                <div style="float:left"><%=timehistory%></div>
                                <div style=" margin-right: 200px;" id="sortkv1" class="down1"></div>
                            </a>                            
                        </th>
                        <th style="width: 21%;">
                            <a href="#" id="titledskv2" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" shape="<%=msgdate%>" onclick="SortSearchNhanVienNK( this.className, this.name, this.lang, this.shape)">
                                <div style="float:left"><%=user%></div>
                                <div style=" margin-right: 70px;" id="sortkv1" class="down1"></div>
                            </a>                            
                        </th>
                        <th style="width: 21%;">
                            <a href="#" id="titledskv3" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" shape="<%=msgdate%>" onclick="SortSearchThaoTacNK( this.className, this.name, this.lang, this.shape)">
                                <div style="float:left"><%=operation%></div>
                                <div style=" margin-right: 70px;" id="sortkv1" class="down1"></div>
                            </a>
                        </th>
                        <th>
                            <a href="#" id="titledskv4" class="down" lang="<%=msgright%>" name="1" shape="<%=msgdate%>" onclick="SortSearchDoiTuongNK( this.className, this.name, this.lang, this.shape)">
                                <div><%=object%></div>
                                <div >
                                    <div id="sortkv2" class="down2"></div>
                                    <div id="sortkv2" class="up2" style="display:none;"></div>
                                </div>
                            </a>
                        </th>
                    </tr>
                    <tr id="searchNK">
                        <td><img onclick="SearchNhatKy(this.alt, this.lang, this.id)" id="<%=msgdate%>" style=" margin-top: 10px; margin-bottom: -20px;" class="searchKV" alt="1" lang="<%=msgright%>" src="../images/search1.png"></td>
                        <td>
                            <div style=" width: 50px; float: left;"><%=from%></div>
                            <input type="textbox" value="<%=tungay%>" maxlength="10" class="text tungay" style=" width: 90px; margin-right: 5px; margin-bottom: 5px;" id="datepicker1">
                            <input type="textbox" value="<%=tugio%>" class="text tugio" style=" width: 30px;  margin-right: 5px;  margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=hours%>
                            <input type="textbox" value="<%=tuphut%>" class="text tuphut" style=" width: 30px; margin-left: 5px; margin-right: 5px;  margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=minutes%><br />
                            <div style=" width: 50px; float: left;"><%=to%></div>
                            <input type="textbox" value="<%=denngay%>" maxlength="10" class="text denngay" style=" width: 90px; margin-right: 5px; margin-bottom: 5px; " id="datepicker2">
                            <input type="textbox" value="<%=dengio%>" class="text dengio" style=" width: 30px;  margin-right: 5px; margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=hours%>
                            <input type="textbox" value="<%=denphut%>" class="text denphut" style=" width: 30px; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=minutes%>
                        </td>
                        <td>
                            <input type="textbox" value="<%=nhanvienn%>" style=" width: 120px;" name="NHANVIEN" class="nhanvien text" size="15" alt="1" lang="<%=msgright%>">
                        </td>
                        <td><input type="textbox" value="<%=thaotacc%>" style=" width: 120px;" name="THAOTAC" class="thaotac text" size="15" alt="1" lang="<%=msgright%>"></td>
                        <td>
                            <input type="textbox" value="<%=doituongg%>" style=" width: 120px;" name="DOITUONG"  size="17" class="doituong text" alt="1" lang="<%=msgright%>">
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <%
                                for (int i = (item - 1) * 10; i < (item - 1) * 10 + 10 && i < vsize; i++) {
                                    Beans.NhatKy nk = (Beans.NhatKy) v.elementAt(i);
                                    total = total + 1;
                    %>
                    <tr>                        
                        <td class="STT"><input type="checkbox" value="<%= nk.getMaNK()%>" class="optionKV" name="optionKV"></td>
                        <td class="TenKV"><%= nk.getNgayGio()%></td>
                        <td ><%=nk.getTenNV()%></td>
                        <td><%=nk.getTenLTT()%></td>
                        <td><%=nk.getTenTS()%></td>
                    </tr>
                    <%  }
                    %>
                    <input type="hidden" name="total" value="<%=total%>">
                </tbody>
            </table>
            <div style="float:left;">
                
                <input type="button" style="margin-left: 0; margin-top: 5px; margin-bottom: 5px;" class="button" value ="<%=delete%>" id="1" lang="<%=msgright%>" onclick="DeleteKV(this.id, this.lang)">
                
            </div>
            <div class="pagination">
                <%
                            int trang = 1;
                            if (item > 1) {
                                trang = item - 1;
                            }
                %>
                <%
                                if (vsize > 10) {%>
                <a href="#" class="prev" lang="<%=msgright%>" name="<%= trang%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)">«</a>
                <%
                                                    for (int c = 1; c <= numpage; c++) {
                                                        if (numpage < 10) {
                                                            if (c != item) {%>
                <a href="#" lang="<%=msgright%>"  name="<%= c%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)" ><%= c%></a>
                <%                } else {%>
                <a class="current"> <%= c%></a>
                <%                }
                                                                                } else {
                                                                                    if (c == item && item == 1) {%>
                <a href="#" lang="<%=msgright%>" class="current"   name="<%= item%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 3%></a>
                ...
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 3%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage%></a>
                <%            }
                                                                                    if (c == item && item != 1) {
                                                                                        if (item < (numpage / 2)) {%>

                <a href="#" lang="<%=msgright%>"   name="<%= item - 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 1%></a>
                <a href="#" lang="<%=msgright%>" class="current"  name="<%= item%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 2%></a>

                ...
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 3%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage - 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage - 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= numpage%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= numpage%></a>
                <%                }%>
                <%                                     if (item >= (numpage / 2) && item != numpage) {
                                                                                  int start = 1;
                %>
                <a href="#" lang="<%=msgright%>"   name="<%= start%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 3%></a>
                ...
                <a href="#" lang="<%=msgright%>"   name="<%= item - 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item - 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 1%></a>
                <a href="#" lang="<%=msgright%>" class="current"  name="<%= item%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item + 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item + 1%></a>
                <%                }
                %>
                <%                                     if (item >= (numpage / 2) && item == numpage) {
                                                                                  int start = 1;
                %>
                <a href="#" lang="<%=msgright%>"   name="<%= start%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 1%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= start + 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= start + 3%></a>
                ...
                <a href="#" lang="<%=msgright%>"   name="<%= item - 3%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 3%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item - 2%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 2%></a>
                <a href="#" lang="<%=msgright%>"   name="<%= item - 1%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item - 1%></a>
                <a href="#" lang="<%=msgright%>" class="current"  name="<%= item%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)"><%= item%></a>

                <%                }
                %>
                <%            }
                                                        }
                                                    }
                %>
                <%
                                                    if (item + 1 <= numpage) {
                                                        trang = item + 1;
                                                    } else {
                                                        trang = item;
                                                    }
                %>
                <a href="#" lang="<%=msgright%>" class="next"  name="<%= trang%>" id="<%=msgdate%>" onclick="SearchNhatKy(this.name, this.lang, this.id)">»</a>
                <%  }
                %>
            </div>
        </form>

    </div>
</div>

